/**
 * This code is released under lgpl v3 license.
 * All rights reserved.
*/

package flash.events;

import bridge.AS3Proxy;
import bridge.FABridge;
import com.google.gwt.core.client.JavaScriptObject;
import flash.display.DisplayObject;

/**
 * base fabridge object(thus as3 object),most as3 object is subclass of
 * EventDispatcher
 * @author yuan yunchang    dukerr@gmail.com
 */
public class EventDispatcher extends AS3Proxy{

    protected EventDispatcher() {
    }
    
    /**
     * create a EventDispatcher. every subclass of EventDispatcher should have
     * a createXXX method to create a new instance
     * @param bridgeName
     * @return
     */
    public final static  EventDispatcher createEventDispatcher(String bridgeName){
        return (EventDispatcher)(FABridge.get().getInstance(bridgeName).create("flash.events.EventDispatcher"));
    }
    /**
     * add event listener
     * @param type      event type
     * @param func      event listener
     */
    public final native void addEventListener(String type,JavaScriptObject func)/*-{
        this.addEventListener(type,func)
    }-*/;
    /**
     * remove event listener
     * @param type      event type
     * @param func      event listener
     */
    public final native void removeEventListener(String type,JavaScriptObject func)/*-{
        this.removeEventListener(type,func)
    }-*/;
    
}
